package com.ellecity06.cwhiskymall.ui.service_setting

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.ellecity06.common.base.BaseAdapter
import com.ellecity06.cwhiskymall.databinding.ItemServiceTestBinding
import com.ellecity06.cwhiskymall.storage.AppStorage

/**
 * @author ellecity06
 * @time 2024/11/14 11:25
 * @des
 */
class ServiceSettingAdapter : BaseAdapter<ServiceModel, ItemServiceTestBinding>() {
    override fun inflateBinding(
        layoutInflater: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): ItemServiceTestBinding {
        return ItemServiceTestBinding.inflate(layoutInflater, parent, false)
    }

    override fun convert(binding: ItemServiceTestBinding, position: Int, item: ServiceModel) {
        binding.tvTitle.text = item.name
        binding.tvAuction.text = "Api环境：${item.apiUrl}"
        binding.tvMall.text = "Web环境：${item.webUrl}"
        binding.tvIp.text = "注册环境：${item.ipWebUrl}"
        binding.dot.visibility = if (item.key == AppStorage.serviceKey) View.VISIBLE else View.GONE
    }
}